package com.dianxin.smartpark.web.park;

import java.util.List;

import cn.dev33.satoken.annotation.SaCheckPermission;
import com.chinatelecom.response.common.CommonResponseBody;
import com.dianxin.smartpark.dao.mapper.common.SmartParkUserConfigMapper;
import com.dianxin.smartpark.dao.qo.park.SmartParkCarParkingQO;
import com.dianxin.smartpark.service.park.SmartParkCarParkParkingService;
import com.dianxin.smartpark.service.park.SmartParkCarParkingService;
import com.dianxin.smartpark.service.vo.park.SmartParkCarParkingVO;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 停车进出日志
 * 
 * @author chenjiasong
 * @date 2021-08-31
 */
@RestController
@RequestMapping("/smartpark/record/parking")
public class SmartParkCarParkingController
{
    @Resource
    private SmartParkCarParkingService smartParkCarParkingService;

    @Resource
    private SmartParkCarParkParkingService smartParkCarParkParkingService;

    /**
     * 查询停车记录列表
     */
    @PostMapping("/list")
    @SaCheckPermission("/smartpark/record/parking/list")
    public CommonResponseBody<List<SmartParkCarParkingVO>>  list(@RequestBody SmartParkCarParkingQO qo)
    {
        return smartParkCarParkingService.selectSmartParkCarParkingList(qo);
    }


    /**
     * 获取停车记录详细信息
     */
    @GetMapping(value = "/getInfo")
    @SaCheckPermission("/smartpark/record/parking/list")
    public CommonResponseBody<SmartParkCarParkingVO> getInfo(SmartParkCarParkingQO qo)
    {
        return smartParkCarParkingService.selectSmartParkCarParking(qo);
    }

    /**
     * 新增停车记录
     */
    @PostMapping("/add")
    public  CommonResponseBody<Boolean> add(@RequestBody SmartParkCarParkingVO vo) throws Exception {
        return smartParkCarParkParkingService.saveSmartParkCarParking(vo);
    }

    /**
     * 修改停车记录
     */
    @PutMapping("/edit")
    @SaCheckPermission("/smartpark/record/parking/edit")
    public  CommonResponseBody<Boolean> edit(@RequestBody SmartParkCarParkingVO vo)
    {
        return smartParkCarParkingService.updateSmartParkCarParking(vo);
    }

    /**
     * 删除停车记录
     */
	@DeleteMapping("/remove")
    @SaCheckPermission("/smartpark/record/parking/remove")
    public  CommonResponseBody<Boolean> remove(@RequestBody SmartParkCarParkingVO vo)
    {
        return smartParkCarParkingService.deleteSmartParkCarParking(vo);
    }
}
